<html>
<head>
<script type="text/javascript" src="loadxmldoc.js"></script>
</head>
<body>

<script type="text/javascript">
xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.documentElement.childNodes;
for (i=0;i<x.length;i++)
{ 
if (x[i].nodeType==1)
  {//Process only element nodes (type 1) 
  document.write(x[i].nodeName);//lay duoc node dau tien cap 1 la book, nau lay 
  //them gia tri no thi x[i].childNodes[0].nodeValue
  document.write("<br />");
  
  y=x[i].childNodes;// y la node cap 2, con cua x.
  for (j=0;j<y.length;j++)
	{ 
	if (y[j].nodeType==1)
	  {//Process only element nodes (type 1) 
	  document.write(y[j].nodeName);
	  //lay duoc node dau tien cap 1 la book, nau lay 
  //them gia tri no thi y[j].childNodes[0].nodeValue
	  document.write("<br />");
	  
	  } 
	}

  
  } 
}

</script>
</body>
</html>